from dns_server import redirect_protocols

if __name__ == '__main__':
    from twisted.python import log
    from twisted.internet import reactor
    import sys
    
    log.startLogging(sys.stdout)
    
    factory = redirect_protocols.DNSRedirectServerFactory( verbose = 1, standalone = True )            
    reactor.run()
else:
    from twisted.application import service

    multi_dns_service = service.MultiService()

    dem_dns_service = redirect_protocols.DNSRedirectServerFactory( verbose = 1 )
    dem_dns_service.tcp_listener.setServiceParent( multi_dns_service )
    dem_dns_service.udp_listener.setServiceParent( multi_dns_service )

    application = service.Application('DEM DNS Redirect Server')
    multi_dns_service.setServiceParent( application )